/*
* INSANE - Interactive Structural Analysis Environment
*
* Copyright (C) 2003-2005
* Universidade Federal de Minas Gerais
* Escola de Engenharia
* Departamento de Engenharia de Estruturas
* 
* Author's email :    insane@dees.ufmg.br
* Author's website :  http://www.dees.ufmg.br/insane
* 
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
package br.ufmg.dees.insane.model.disc.analysismodel;

import br.ufmg.dees.insane.materialMedia.material.MSpring;
import br.ufmg.dees.insane.model.disc.element.FrameElement;
import br.ufmg.dees.insane.util.IMatrix;
import br.ufmg.dees.insane.util.IVector;

/**
*A class representing the analysis model of a spring element to be used with a PlaneFrame global AnalysisModel.<p>
*
*A Spring must connect two coincident Nodes: Nodes with the same coords.<p>
*Because of this, the local axis of a Spring element are paralel to the global axis.
*
*@author Fonseca, Flavio & Pitangueira, Roque
*@version 1.0
*@since October 2003
*@see model.discrete.element.FrameElement
*/


public class SPlaneFrame extends PlaneFrame {
	
	private static final long serialVersionUID = 1L;

	/** Constructs a SPlaneFrame analysis mode, sets its ndf to 3 and its valid equations to true in the positions 0, 1 and 5.*/
	public SPlaneFrame() {
		type = "SPlaneFrame";
		ndf = 3;
		validEquations[0] = true;
		validEquations[1] = true;
		validEquations[2] = false;
		validEquations[3] = false;
		validEquations[4] = false;
		validEquations[5] = true;
		dominion = 1;
	};
	
//********************************************************************************
	
	/** Returns the nodal rotation matrix of the specified FrameElement, accordingly to this AnalysisModel type.
	*@param elm The FrameElement whose nodal rotation matrix is desired.
	*@return The nodal rotation matrix of the specified FrameElement, accordingly to this AnalysisModel type.
	*/
	public IMatrix nodalRotationMatrix(FrameElement elm) {
		//A SPlaneFrame element do not accept inclined supports
		IMatrix mat = new IMatrix(6, 6);
		return (mat);
	};
	
//********************************************************************************
	
	/** Returns the local stiffness matrix of the specified FrameElement, accordingly to this AnalysisModel type.<br>
	*This matrix does not consider the possible liberations at the extremities of the FrameElement.
	*@param elm The FrameElement whose local stiffness matrix is desired.
	*@return The local stiffness matrix of the specified FrameElement, accordingly to this AnalysisModel type.
	*/
	public IMatrix localStiffnessMatrix(FrameElement elm){
		IMatrix mat = new IMatrix(6, 6);
		mat.setZero();
		MSpring spr = (MSpring) elm.getMaterial();
		
		//Setting the values of the matrix
		mat.setElement(0, 0, spr.getStiffness(0));
		mat.setElement(1, 1, spr.getStiffness(1));
		mat.setElement(2, 2, spr.getStiffness(5));
		mat.setElement(3, 3, spr.getStiffness(0));
		mat.setElement(4, 4, spr.getStiffness(1));
		mat.setElement(5, 5, spr.getStiffness(5));
		mat.setElement(0, 3, -spr.getStiffness(0));
		mat.setElement(1, 4, -spr.getStiffness(1));
		mat.setElement(2, 5, -spr.getStiffness(5));
		mat.setElement(3, 0, -spr.getStiffness(0));
		mat.setElement(4, 1, -spr.getStiffness(1));
		mat.setElement(5, 2, -spr.getStiffness(5));
		
		return (mat);
	};
	
//********************************************************************************
	
	/** Returns the corrected local stiffness matrix of the specified FrameElement, accordingly to this AnalysisModel type.
	*This matrix is corrected to consider the liberations at the extremities of the FrameElement.
	*@param elm The FrameElement whose corrected local stiffness matrix is desired.
	*@return The corrected local stiffness matrix of the specified FrameElement, accordingly to this AnalysisModel type.
	*/
	public IMatrix localCorrectedStiffnessMatrix(FrameElement elm) {
		return (localStiffnessMatrix(elm));
	};
	
//********************************************************************************
	
	/** Returns the transformation matrix of the specified FrameElement, accordingly to this AnalysisModel type.
	*@param elm The FrameElement whose transformation matrix is desired.
	*@return The transformation matrix of the specified FrameElement, accordingly to this AnalysisModel type.
	*/
	public IMatrix transformationMatrix(FrameElement elm){
		IMatrix mat = new IMatrix(6, 6);
		mat.setIdentity();
		return (mat);
	};
	
//********************************************************************************
	
	/** Mounts the shape function matrix accordingly to this AnalysisModel type with the values of two IVectors.<br>
	*The first IVector must contain the shape functions values which will be put in the upper part of the matrix.<br>
	*The second IVector must contain the shape functions values which will be put in the lower part of the matrix (related to the derivated shape functions).
	*@param n1 A IVector containing the shape functions values which will be put in the upper part of the matrix.
	*@param n2 A IVector containing the shape functions values which will be put in the upper part of the matrix.
	*@return The shape function matrix accordingly to this AnalysisModel type.
	*/
	public IMatrix mountMatrixN(IVector n1, IVector n2) {
		return (null);
	};
	
//********************************************************************************
	
	/** Mounts the shape function matrix accordingly to this AnalysisModel type with the values of one IVector.<br>
	*The IVector must contain the shape functions values which will be put in the upper part of the matrix.<br>
	*The value zero will be put in the lower part of the matrix (related to the derivated shape functions).
	*@param n1 A IVector containing the shape functions values which will be put in the upper part of the matrix.
	*@return The shape function matrix accordingly to this AnalysisModel type.
	*/
	public IMatrix mountMatrixN(IVector n1) {
		return (null);
	};
	
//********************************************************************************
	
	/** Returns the local equivalent nodal force vector of the specified FrameElement, accordingly to this AnalysisModel type.
	*This vector does not consider the possible liberations at the extremities of the FrameElement.
	*@param elm The FrameElement whose local equivalent nodal force vector is desired.
	*@return The local equivalent nodal force vector of the specified FrameElement, accordingly to this AnalysisModel type.
	*/
	public IVector localEquivalentForceVector(FrameElement elm) {
		return (null);
	};
	
//********************************************************************************
	
	/** Returns the corrected local equivalent nodal force vector of the specified FrameElement, accordingly to this AnalysisModel type.
	*This matrix is corrected to consider the liberations at the extremities of the FrameElement.
	*@param elm The FrameElement whose corrected local equivalent nodal force vector is desired.
	*@return The corrected local equivalent nodal force vector of the specified FrameElement, accordingly to this AnalysisModel type.
	*/
	public IVector localCorrectedEquivalentForceVector(FrameElement elm) {
		IVector vec = new IVector(6);
		return (vec);
	};
	
//********************************************************************************

}
